<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
//如果当前用户已经登录,直接跳转操作
if(request.getSession() != null && request.getSession().getAttribute("user")!=null){
	request.getRequestDispatcher("/admin/index.jsp").forward(request, response);
}
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>大旗科技有限公司</title>
		<meta name="keywords" content="大旗科技有限公司" />
  		<meta name="description" content="大旗科技有限公司" />
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=no">
  		<link type="image/x-icon" rel="shortcut icon" href="/favicon.ico" />
		<meta http-equiv="Access-Control-Allow-Origin" content="*">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
  		<link type="image/x-icon" rel="shortcut icon" href="<%=basePath %>/favicon.ico" />
  		<link rel="stylesheet" type="text/css" href="<%=basePath %>/resource/bootstrap/bootstrap.min.css" />
  		<link rel="stylesheet" type="text/css" href="<%=basePath %>/resource/layui/css/layui.css" />
  		<link rel="stylesheet" type="text/css" href="<%=basePath %>/resource/css/login.css"/>
  		<link rel="stylesheet" type="text/css" href="<%=basePath %>/resource/fonts/iconfont.css" />
	</head>
	<script type="text/javascript">
		if (window != top)  {
			top.location.href = "<%=basePath %>/login.jsp";  
		}
	</script>
	<body>
		<div class="content-panel absolute-center">
			<div class="logo">
				<img src="<%=basePath %>/resource/img/logo.png" alt="大旗科技" class="img-rounded">
			</div>	
			<p class="enterprise">
				大旗科技有限公司				
			</p>
			<form class="layui-form" action="<%=basePath %>/login" method="post">
				<div class="layui-form-item">
				    <div class="layui-input-block">
				      	<input type="text" name="username" required  lay-verify="required" 
				      		placeholder="用户名" autocomplete="off" class="layui-input">
				    </div>
				</div>
				<div class="layui-form-item">
				    <div class="layui-input-block">
				      	<input type="password" name="password" required  lay-verify="required" 
				      		placeholder="密码" autocomplete="off" class="layui-input">
				    </div>
				</div>
				<div class="layui-form-item">
				    <div class="layui-input-block">
				    	<input type="text" name="captcha" required  lay-verify="required" 
				      		placeholder="验证码" autocomplete="off" class="layui-input">
				      	<span class="captcha">
				      		<img id="captcha" src="<%=basePath %>/captcha" onclick="refreshcode()" />
				      	</span>
				    </div>
				</div>
				<div class="layui-form-item">
					<input type="submit" autocomplete="off" class="layui-btn layui-btn-normal" value="登录">
				</div>
			</form>
			<p>
				<span class="layui-badge layui-bg-green">状态：${error }</span>
			</p>
		</div>
		<p class="record-number">互联网ICP备案：粤ICP备18073646号-1</p>
		<canvas id="Mycanvas"></canvas>
		<script	src="<%=basePath %>/resource/js/login-canvas.js" charset="UTF-8"></script>
		<script type="text/javascript">
			//刷新验证码
			function refreshcode(){
            	document.getElementById("captcha").src ="<%=basePath %>/captcha?hehe="+Math.random();
        	}
		</script>
	</body>
</html>
    